#
# @lc app=leetcode.cn id=53 lang=python3
#
# [53] 最大子数组和
#

# @lc code=start
class Solution:
    def maxSubArray(self, nums: List[int]) -> int:
        pre=0
        maxnum=nums[0]
        for i in nums:
            pre=max(i,pre+i)
            maxnum=max(pre,maxnum)
        return maxnum
# @lc code=end

